#include"loadingBar.h"
#include<string.h>
#include<unistd.h>

const char *lable = "|/-\\";
char bar[NUM];

void loadingBar(int rate)
{
    if(rate < 0 || rate > 100)
    {
        return ;
    }

    int len = strlen(lable);
   
    //printf("I'm working!\n");
    
    printf("[%-100s] [%d%%] [%c]\r", bar, rate, lable[rate%len]);    
    fflush(stdout);
    bar[rate++] = STYLE;  
}
